package Q1;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        if (n == 1) {
            System.out.println(1);
            return;
        }

        int left = 0, right = 1;
        int ret = 0;
        while (right < n) {
            boolean flag = false;
            while (right < n && arr[right] >= arr[left]) { //非递减
                right++;
                left++;
                flag = true;
            }
            if (flag) {
                ret++;
            }
            flag = false;
            while (right < n && arr[right] <= arr[left]) { //非递增
                right++;
                left++;
                flag = true;
            }
            if (flag) {
                ret++;
            }
        }

        System.out.println(ret);
    }
}
